#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 2020/11/30 10:17

@author: aimee.mei
"""
import logging,traceback
from util.db_util import execute_query


def get_customers_bu_count(bu_code):
    """ 获取分行追踪客户总数

    :return: 总数
    """

    results = execute_query(
        "SELECT COUNT(*) FROM risk_interest_customer where bu_code = '%s' and status =1; " %(bu_code) )
    try:
        result = results[0][0]
        return result
    except Exception as e:
        logging.error("no result retrieved")
        return None



def get_customers_org_count():
    """ 获取总行追踪客户总数

    :return: 总数
    """

    results = execute_query(
        "SELECT COUNT(*) FROM risk_interest_customer where status =1 ; "  )

    try:
        result = results[0][0]
        return result
    except Exception as e:
        logging.error("no result retrieved")
        return None
